<?php
/**
 * CONTENIDO extension pack (mpContenidoX), consists of multiple classes to
 * provide more features for Plugins/Modules.
 *
 * @package     mpContenidoX
 * @subpackage  PluginInstaller
 * @author      Murat Purc <murat@purc.de>
 * @copyright   Copyright (c) 2008-2012 Murat Purc (http://www.purc.de)
 * @license     http://www.gnu.org/licenses/gpl-2.0.html - GNU General Public License, version 2
 * @version     $Id: Factory.class.php 21 2012-07-16 21:33:14Z purcaholic $
 */


defined('CON_FRAMEWORK') or die('Illegal call');


/**
 * Final plugin setup factory class
 *
 * @package     mpContenidoX
 * @subpackage  PluginInstaller
 * @author      Murat Purc <murat@purc.de>
 */
final class mpPluginInstaller_Factory
{

    /**
     * Returns the plugin installer instance.
     * Note:
     * The file contains installer clas must be included before!
     *
     * @param   string  $className  Classname of plugin installer to instantiate.
     * @return  mpPluginInstaller_Interface
     * @throws  Exception  If classname is missing.
     */
    public static function getInstaller($className)
    {
        if (!class_exists($className)) {
            throw new mpPluginInstaller_Exception('mpPluginInstaller_Factory:getInstaller() Class "' . $className
                . '" doesn\'t exists, include classfile before calling factory');
        }
        return new $className();
    }

}
